﻿--[[
   @brief    管理下灰度用户提示信息
   @author   rickonzhang
   @version  1.0
   @date     2016-06-28
--]]
test_user_control = 
{
};

function test_user_control.init()
    -- body
end

function test_user_control.on_msg_list_tips_create(uilib, ctrl_id)
    local out = comm_center.call_service("i_service_mainframe_get_current_mode", {});
    if out.mode == 0 then --max
        contact_list_model.max_mode_msg_list_tips_id = ctrl_id;
    else
        contact_list_model.min_mode_msg_list_tips_id = ctrl_id;
    end
    test_user_control.update_test_info();
end

function test_user_control.on_contact_list_tips_create(uilib, ctrl_id)
    local out = comm_center.call_service("i_service_mainframe_get_current_mode", {});
    if out.mode == 0 then --max
        contact_list_model.max_mode_contact_list_tips_id = ctrl_id;
    else
        contact_list_model.min_mode_contact_list_tips_id = ctrl_id;
    end
    test_user_control.update_test_info();
end

--灰度信息获取OK
function test_user_control.on_get_social_test_info_done(event_id, json_str)
    local result_param = base_utility.json_to_table(json_str);
    if result_param["result"] == 0 then
        contact_list_model.social_user_level = result_param["level"];
    end
    contact_list_model.get_user_level_done = true;
    test_user_control.update_test_info();
end

function test_user_control.update_test_info()
    if contact_list_model.get_user_level_done == true then

        local is_show = "false";
        if contact_list_model.social_user_level == 0 then --普通用户
            is_show = "true";
        end

        if contact_list_model.max_mode_contact_list_tips_id > 0 then
            ui_utility.setproperty_by_id(contact_list_model.max_mode_contact_list_tips_id, "Visible", is_show);
        end
        if contact_list_model.min_mode_contact_list_tips_id > 0 then
            ui_utility.setproperty_by_id(contact_list_model.min_mode_contact_list_tips_id, "Visible", is_show);
        end
        if contact_list_model.max_mode_msg_list_tips_id > 0 then
            ui_utility.setproperty_by_id(contact_list_model.max_mode_msg_list_tips_id, "Visible", is_show);
        end
        if contact_list_model.min_mode_msg_list_tips_id > 0 then
            ui_utility.setproperty_by_id(contact_list_model.min_mode_msg_list_tips_id, "Visible", is_show);
        end
    end
end

test_user_control.init();